Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Solved: Date format for {VALIDUNTIL} - use {date('...',strtotime(VALIDUNTIL))}

  • Indispirit
  • Indispirit's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #188862 by Indispirit
Date format for {VALIDUNTIL} was created by Indispirit
Hi all

Are there any expressions I can use to format the out put of date fields such as {VALIDUNTIL} and {VALIDFROM}?


For example, the raw output is: 2019-12-18 11:38:00


We'd like to format as: 18 December.


If some detail is available I could have a go at updating the wiki.
The topic has been locked.
  • Indispirit
  • Indispirit's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #188889 by Indispirit
Replied by Indispirit on topic Date format for {VALIDUNTIL}
I've been trying:

{date_format(VALIDUNTIL, 'd F Y')}

but this returns a blank. I was using the information at www.w3schools.com/PHP/func_date_date_format.asp

..but is there somewhere else for a full list of supported expressios I should be looking?

The validate expression function in the email templates seems to suggest date_format is supported.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago - 4 years 7 months ago #188901 by DenisChenu
Replied by DenisChenu on topic Date format for {VALIDUNTIL}
Expression didn't have date_format function.

But you can use date and strtotime function

Try
{date('d F Y',strtotime(VALIDUNTIL))}

PS: VALIDUNTIL or VALIDFROM variables can be used only in email template

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 7 months ago by DenisChenu. Reason: close bracket
The following user(s) said Thank You: Indispirit
The topic has been locked.
  • Indispirit
  • Indispirit's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #188943 by Indispirit
Thanks Dennis, worked like a charm.

Is there an alphabetical list of all the functions available anywhere? I think even a raw list of alphabetical of entries people could cross reference with online PHP manuals we be very helpful.

For example, in our case, there is some coding we've done in Java in the question section that we could probably shift to PHP if we knew the full functionality available.

Cheers!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188945 by DenisChenu

Indispirit wrote: Is there an alphabetical list of all the functions available anywhere? I think even a raw list of alphabetical of entries people could cross reference with online PHP manuals we be very helpful.

If you click on the link of my previous post : manual.limesurvey.org/Expression_Manager#Access_to_Functions

Else : we have on inside LimeSUrvey, but since UI is broken and whole are not testes, show in the menu only with debug >2
=> You can put a feature request to to have it somewhere in LimeSurvey admin UI :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Indispirit
The topic has been locked.
  • Indispirit
  • Indispirit's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
4 years 7 months ago #188946 by Indispirit
Thanks - can see dateformat is on the "Functions that are Planned or Being Considered" list too.
The topic has been locked.
More
4 years 7 months ago #189016 by jelo

Indispirit wrote: Thanks - can see dateformat is on the "Functions that are Planned or Being Considered" list too.

Well, in LS4 Denis did some coding to expose PHP functions more easily to ExpressionScript (ExpressionManager). That will bring new life to the "Functions that are planned or being considered".

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu, Indispirit
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose